/*
 * @Descripttion: 
 * @Author: cuidm
 * @Date: 2022-07-14 15:10:40
 * @LastEditors: cuidm
 * @LastEditTime: 2022-10-25 14:35:32
 */
import G6 from '@antv/g6';
// 默认节点配置
export const defaultCircleNodeConfig = {
    type: 'modelRect-node',
    size: 26,
    style: {
        cursor: 'pointer',
        fill: '#3056E3',
        shadowColor: '#1b47ea',
        shadowBlur: 1,
        fillOpacity: 0.5,
    },
    icon: {
        fontFamily: 'iconfont',
        fill: '#ffffff',
        show: true,
        fontSize: 16
    },
    labelCfg: {//字体样式
        position: 'bottom',
        offset: 10,
        style: {
            fill: '#666',
            fontSize: 12,
        },
    },
    anchorPoints: [
        [0, 0.5],
        [1, 0.5],
    ]
}

export const defaultNodeConfig = {
    type: 'rect-node',
    style: {
        cursor: 'pointer',
        fill: '#ffffff',
        stroke: '#3056E3',
    },
    labelCfg: {//字体样式
        style: {
            fill: '#666',
            fontSize: 12,
        },
    },
    anchorPoints: [
        [0, 0.5],
        [0.5, 0],
        [1, 0.5],
        [0.5, 1],
    ]
}

// 默认线条配置
export const defaultEdgeConfig = {
    type: 'can-running',
    style: {
        stroke: '#3056E3',
        strokeOpacity: 1,
        lineWidth: 1.5,
        lineAppendWidth: 3,
        endArrow: { 
            path: G6.Arrow.triangle(8, 8, 1),
            d: 0,
            fill: '#3056E3',
        },
    },
    labelCfg: {
        autoRotate: true,
        refY: 10,
    }
};

export const defaultLayout = {
    type: 'force',
    preventOverlap: true,
    nodeSpacing: 50,
    linkDistance: (d) => {
      return 150;
    },
    nodeStrength: (d) => {
      if (d.isLeaf) {
        return -50;
      }
      return -10;
    },
}